/**
 * apple的APNS代理:配置好的push证书，放到同一个目录
 * auther: lifuyuan
 * date:2018-05-07
 * time:15:00
 * create apns.js
 * 设置推送通知服务
 * 
*/
const apns = require('apn');
let options = {
    "gateway":"gateway.sandbox.apple.com"
}
let apnsProxy = new apns.Connection(options);
let token = '...';
let targetDev = new apns.Device(token);
notify = apns.Notification();
notify.expiry = Math.floor(Date.now() / 1000) + 3600;
notify.badge = 1;
notify.sound = 'ping.aiff';
notify.alert = 'nice to meet you'
notify.payload = {
    "messageForm":"Caroline"
}
apnsProxy.pushNotifycation(notify,targetDev);